/**
  ******************************************************************************
  * @文件名称 : disp_curve.c
  * @摘要 : 
  * @创建日期 : Aug 1, 2024
  * @创建者：Mbl
  ******************************************************************************
  * @使用说明
  *
  *  
  ******************************************************************************
  */

/* 声明包含头文件 -----------------------------------------------------------*/
#include "../Inc/disp_curve.h"
#include "../Inc/data_public.h"
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
/* 声明私有类型定义---------------------------------------------------------*/

/* 声明私有变量 -------------------------------------------------------------*/
/* 曲线界面 */
static lv_obj_t* dataExportBtn;  //数据导出按钮
static lv_obj_t* enlargeBtn;     //放大按钮
static lv_obj_t* reduceBtn;		 //缩小按钮
static lv_obj_t* newPosBtn;		 //回到最新位置按钮
static lv_obj_t* oldPosBtn;		 //回到最新位置按钮
static ta_userData_t taUser_textarea[2];	 // 输入框
static lv_point_t line_points[] = { {0, 0}, {33, 0} };  //线条起始坐标
static lv_obj_t* tempCurveBtn;  //温度曲线按钮
static lv_obj_t* flowCurveBtn;  //流量曲线按钮
static lv_obj_t* pressCurveBtn;  //压力曲线按钮
static int16_t tempChartyMin = 5;  //温度曲线Y轴显示最小值
static int16_t tempChartyMax = 35;  //温度曲线Y轴显示最大值
static int16_t flowChartyMin = 0;  //流量曲线Y轴显示最小值
static int16_t flowChartyMax = 20;  //流量曲线Y轴显示最大值
static int16_t pressChartyMin = 0;  //压力曲线Y轴显示最小值
static int16_t pressChartyMax = 500;  //压力曲线Y轴显示最大值

/* 数据导出窗口 */
static lv_obj_t* dataExpLabel;  //数据导出窗口标签
static lv_obj_t* dataExpConfBtn;  //数据导出确认按钮
static lv_obj_t* dataExpCancelBtn;  //数据导出取消按钮
static lv_obj_t* dataExpConfFinishBtn;  //数据导出完成确认按钮

/* 曲线显示相关部件 */
static lv_chart_series_t* yser1;  //曲线Y轴序列1
static lv_chart_series_t* yser2;  //曲线Y轴序列2
static lv_chart_series_t* yser3;  //曲线Y轴序列3

static lv_obj_t* labelx;   //曲线时间显示标签
static lv_obj_t* labely1;  //曲线数值显示标签1
static lv_obj_t* labely2;  //曲线数值显示标签2
static lv_obj_t* labely3;  //曲线数值显示标签3

/* 曲线相关部件 */

static lv_obj_t* tempChart;  //温度图表
static lv_obj_t* flowChart;  //流量图表
static lv_obj_t* pressChart;  //压力图表
static lv_chart_cursor_t* tempCursor;  //温度曲线光标
static lv_chart_cursor_t* flowCursor;  //流量曲线光标
static lv_chart_cursor_t* pressCursor;  //流量曲线光标
static lv_timer_t* timer;  //定时器  1S
static lv_timer_t* expTimer;  //导出脚本定时器  200ms

/* 曲线数据相关 */
//static lv_coord_t dataBuf1[CURVEDATASUM] __attribute__((section (".ccmram")));
//static lv_coord_t dataBuf2[CURVEDATASUM] __attribute__((section (".ccmram")));
//static lv_coord_t dataBuf3[CURVEDATASUM] __attribute__((section (".ccmram")));
static lv_coord_t dataBuf1[CURVEDATASUM];
static lv_coord_t dataBuf2[CURVEDATASUM];
static lv_coord_t dataBuf3[CURVEDATASUM];
static uint16_t flag = 0;  //显示曲线步骤标志
static uint16_t bufPoint = 0;  //数组定位
static lv_coord_t lastMinScale;		  //上一次曲线刻度下限
static lv_coord_t lastMaxScale;		  //上一次曲线刻度上限
static lv_coord_t tempZoom = 5376;		  //温度曲线缩放数值
static lv_coord_t flowZoom = 5376;		  //流量曲线缩放数值
static lv_coord_t pressZoom = 5376;		  //压力曲线缩放数值
static uint16_t tempArrayPos;		  //温度曲线当前按压点
static uint16_t flowArrayPos;		  //流量曲线当前按压点
static uint16_t pressArrayPos;		  //压力曲线当前按压点
static uint8_t tempMultiple = 21;	  //温度曲线缩放倍数
static uint8_t flowMultiple = 21;	  //流量曲线缩放倍数
static uint8_t pressMultiple = 21;	  //压力曲线缩放倍数
static uint16_t tempDistance = 0;	  //温度曲线偏移距离
static uint16_t flowDistance = 0;	  //流量曲线偏移距离
static uint16_t pressDistance = 0;	  //压力曲线偏移距离
static lv_point_t lastPoint;		  //上一次按压点
static lv_point_t nowPoint;			  //当前按压点
/* 声明私有常量 -------------------------------------------------------------*/

/* 声明私有宏定义 -----------------------------------------------------------*/
#define DEFAULT_CURVE_MAX_MULTIPLE  (5376)   // 最大放大10倍
#define DEFAULT_CURVE_REFRESH_TIME  (5)     // 曲线刷新速率
#define DEFAULT_TEMPCURVE_UP        (35)     // 温度曲线上限
#define DEFAULT_TEMPCURVE_DOWN      (5)     // 温度曲线下限
#define DEFAULT_FLOWCURVE_UP        (20)     // 流量曲线上限
#define DEFAULT_FLOWCURVE_DOWN      (0)     // 流量曲线下限
#define DEFAULT_PRESSCURVE_UP       (500)    // 压力曲线上限
#define DEFAULT_PRESSCURVE_DOWN     (0)     // 压力曲线下限
/* 声明私有函数 -------------------------------------------------------------*/

/**
  * @brief  曲线界面删除(不包含背景)
  * @param  无
  * @retval 无
  */
static void UI_delete_curve_no_bg(void)
{
	lv_obj_del(parentObj);  //删除当前界面
	lv_timer_del(timer);  //删除当前界面定时器
	flag = 0;
	bufPoint = 0;
}
/**
* @brief 曲线界面按钮回调
* @param *e ：事件相关参数的集合，它包含了该事件的所有数据
* @return 无
*/
static void UI_curve_btn_event_cb(lv_event_t* e)
{
    lv_obj_t* target = lv_event_get_target(e); /* 获取触发源 */
    if (target == dataExportBtn)  //数据导出按钮
    {
        UI_create_curve_export_display();
    }
    else if (target == tempCurveBtn)  //温度曲线按钮
    {
    	UI_delete_curve_no_bg();
    	UI_create_curve_temp();
    	lv_obj_add_state(tempCurveBtn, LV_STATE_CHECKED);
    	lv_obj_clear_state(flowCurveBtn, LV_STATE_CHECKED);
    	lv_obj_clear_state(pressCurveBtn, LV_STATE_CHECKED);
    }
    else if (target == flowCurveBtn)  //流量曲线按钮
    {
    	UI_delete_curve_no_bg();
    	UI_create_curve_flow();
    	lv_obj_add_state(flowCurveBtn, LV_STATE_CHECKED);
    	lv_obj_clear_state(tempCurveBtn, LV_STATE_CHECKED);
    	lv_obj_clear_state(pressCurveBtn, LV_STATE_CHECKED);
    }
    else if (target == pressCurveBtn)  //压力曲线按钮
    {
    	UI_delete_curve_no_bg();
    	UI_create_curve_press();
    	lv_obj_add_state(pressCurveBtn, LV_STATE_CHECKED);
    	lv_obj_clear_state(tempCurveBtn, LV_STATE_CHECKED);
    	lv_obj_clear_state(flowCurveBtn, LV_STATE_CHECKED);
    }
}

/**
  * @brief	输入框初始化函数
  * @param  None
  * @retval None
  */
static void textarea_init(int16_t * chartDown, int16_t * chartUp)
{
	taUser_textarea[0].data.userData.value = chartUp;
	taUser_textarea[0].data.userData.store_enable = 0;
	taUser_textarea[0].data.min = *chartDown;
	taUser_textarea[0].data.max = *chartUp;
	taUser_textarea[1].data.userData.value = chartDown;
	taUser_textarea[1].data.userData.store_enable = 0;
	taUser_textarea[1].data.min = *chartDown;
	taUser_textarea[1].data.max = *chartUp;
	for (uint8_t i = 0; i < 2; i++)
	{
		taUser_textarea[i].width = lv_pct(10);
		taUser_textarea[i].height = lv_pct(10);
		taUser_textarea[i].max_length = 6;
		taUser_textarea[i].accepted_chars = "0123456789-.";
		taUser_textarea[i].one_line = true;
		taUser_textarea[i].pos_x = lv_pct(89);
		taUser_textarea[i].type = "%d";
	}
	taUser_textarea[0].pos_y = lv_pct(7);
	taUser_textarea[1].pos_y = lv_pct(28);
}
static void refresh_textarea(void)
{
	/* 遍历屏幕的父对象的所有子对象 */
	for(uint8_t i = 0; i < lv_obj_get_child_cnt(parentObj); i++)
	{
		lv_obj_t* child = lv_obj_get_child(parentObj, i);
		/* 遍历所有输入框子对象 */
		if(lv_obj_check_type(child, &lv_textarea_class))
		{
			char str[10] = {0};
			ta_userData_t userData = *(ta_userData_t *)lv_obj_get_user_data(child);
			if(type_is_float(userData.type))
				sprintf(str, userData.type, *(float*)userData.data.userData.value);
			else
				sprintf(str, userData.type, *(int16_t*)userData.data.userData.value);
			lv_textarea_set_text(child, str);
		}

	}
}


/**
* @brief 温度曲线部件事件回调
* @param *e ：事件相关参数的集合，它包含了该事件的所有数据
* @return 无
*/
void UI_temp_curve_event_cb(lv_event_t* e) {

    lv_event_code_t code = lv_event_get_code(e);
    lv_obj_t* target = lv_event_get_target(e); /* 获取触发源 */
    uint8_t formCnt_x = 0;
    uint16_t deviation = 0;
    uint16_t point = 0;
	lv_coord_t cont_width;

	if (target == tempChart)  //温度图表部件
	{
		if (code == LV_EVENT_PRESSED)  //点击
		{
			tempArrayPos = lv_chart_get_pressed_point(tempChart); // 获取触摸点的索引
			lv_chart_set_cursor_point(tempChart, tempCursor, yser2, tempArrayPos);//设置光标到触摸点对应的数据点
			/* 计算定位点对应的数组元素 */
			deviation = CURVEDATASUM - 1 - bufPoint;
			if(tempArrayPos < deviation)
			{
				point = bufPoint + tempArrayPos + 1;
			}
			else
			{
				point = tempArrayPos - deviation;
			}
			/* 时间标签 */
			lv_label_set_text_fmt(labelx, "Time: %2d:%02d:%02d", curveData[point].chartTime.hour,\
					curveData[point].chartTime.min,curveData[point].chartTime.sec);  //时间
			/* 数值标签 */
			lv_label_set_text_fmt(labely1, "SV: %.2f", curveData[point].tempSV);   //大小
			lv_label_set_text_fmt(labely2, "PV1: %.2f", curveData[point].tempPV1);  //大小
			lv_label_set_text_fmt(labely3, "PV2: %.2f", curveData[point].tempPV2);  //大小

		}
	}
    else if (target == newPosBtn)
    {
    	cont_width = lv_obj_get_content_width(tempChart);
    	if (tempDistance < cont_width * (tempMultiple - 1))
    	{
    		lv_obj_clear_state(oldPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    		tempDistance += nowPoint.x - lastPoint.x;
    		lv_obj_scroll_to_x(tempChart, tempDistance, LV_ANIM_OFF);
    		lv_chart_refresh(tempChart);
    	}
    	else
    	{
    		lv_obj_add_state(newPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    	}

    }
    else if (target == oldPosBtn)
    {
    	if (tempDistance > 0)
    	{
    		lv_obj_clear_state(newPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    		tempDistance -= nowPoint.x - lastPoint.x;
    		lv_obj_scroll_to_x(tempChart, tempDistance, LV_ANIM_OFF);
    		lv_chart_refresh(tempChart);
    	}
    	else
    	{
    		lv_obj_add_state(oldPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    	}
    }
    else if (target == enlargeBtn)
    {

    	if (tempZoom < DEFAULT_CURVE_MAX_MULTIPLE)
    	{
    		lv_obj_clear_state(reduceBtn, LV_STATE_DISABLED);    // 清除禁用状态
    		lv_obj_clear_state(newPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    		lv_obj_clear_state(oldPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用

    		tempZoom += LV_IMG_ZOOM_NONE * 5;	//扩大一倍
    		tempMultiple = tempZoom / LV_IMG_ZOOM_NONE;
    		formCnt_x = tempMultiple * 5;
    		lv_chart_get_point_pos_by_id(tempChart, yser2, tempArrayPos, &lastPoint);
            lv_chart_set_zoom_x(tempChart, tempZoom);  				  //X轴缩放
    		lv_chart_get_point_pos_by_id(tempChart, yser2, tempArrayPos, &nowPoint);
    		tempDistance = (tempMultiple / 5) * (nowPoint.x - lastPoint.x);
    		lv_chart_set_div_line_count(tempChart, 5, formCnt_x);  //重新分配分割线数量
            lv_obj_scroll_to_x(tempChart, (tempMultiple / 5)*(nowPoint.x - lastPoint.x), LV_ANIM_OFF);
            lv_chart_refresh(tempChart);  //刷新
            if (tempZoom == DEFAULT_CURVE_MAX_MULTIPLE)
            {
            	lv_obj_add_state(enlargeBtn, LV_STATE_DISABLED);    // 达到最大值禁用
            }
    	}

    }
    else if (target == reduceBtn)
    {
    	if (tempZoom > LV_IMG_ZOOM_NONE)
    	{
    		lv_obj_clear_state(enlargeBtn, LV_STATE_DISABLED);  // 清除禁用状态
    		lv_obj_clear_state(newPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    		lv_obj_clear_state(oldPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    		tempZoom -= LV_IMG_ZOOM_NONE * 5;	//缩小一倍
    		tempMultiple = tempZoom / LV_IMG_ZOOM_NONE;
    		formCnt_x = tempMultiple * 5;
    		lv_chart_get_point_pos_by_id(tempChart, yser2, tempArrayPos, &nowPoint);
            lv_chart_set_zoom_x(tempChart, tempZoom);  				  //X轴缩放
    		lv_chart_get_point_pos_by_id(tempChart, yser2, tempArrayPos, &lastPoint);
    		tempDistance = (tempMultiple / 5) * (nowPoint.x - lastPoint.x);
    		lv_chart_set_div_line_count(tempChart, 5, formCnt_x);  //重新分配分割线数量
            lv_obj_scroll_to_x(tempChart, (tempMultiple / 5)*(nowPoint.x - lastPoint.x), LV_ANIM_OFF);
            lv_chart_refresh(tempChart);  //刷新
            if (tempZoom <= LV_IMG_ZOOM_NONE)
            {
            	lv_obj_add_state(reduceBtn, LV_STATE_DISABLED);    // 达到最大值禁用
            }
    	}

    }
}
/**
* @brief 流量曲线部件事件回调
* @param *e ：事件相关参数的集合，它包含了该事件的所有数据
* @return 无
*/
void UI_flow_curve_event_cb(lv_event_t* e) {

    lv_event_code_t code = lv_event_get_code(e);
    lv_obj_t* target = lv_event_get_target(e); /* 获取触发源 */
    uint8_t formCnt_x = 0;
    uint16_t deviation = 0;
    uint16_t point = 0;
	lv_coord_t cont_width;

	if (target == flowChart)  //温度图表部件
	{
		if (code == LV_EVENT_PRESSED)  //点击
		{
			flowArrayPos = lv_chart_get_pressed_point(flowChart); // 获取触摸点的索引
			lv_chart_set_cursor_point(flowChart, flowCursor, yser2, flowArrayPos);//设置光标到触摸点对应的数据点
			/* 计算定位点对应的数组元素 */
			deviation = CURVEDATASUM - 1 - bufPoint;
			if(flowArrayPos < deviation)
			{
				point = bufPoint + flowArrayPos + 1;
			}
			else
			{
				point = flowArrayPos - deviation;
			}
			/* 时间标签 */
			lv_label_set_text_fmt(labelx, "Time: %2d:%02d:%02d", curveData[point].chartTime.hour,\
					curveData[point].chartTime.min,curveData[point].chartTime.sec);  //时间
			/* 数值标签 */
			lv_label_set_text_fmt(labely1, "SV: %.1f", curveData[point].flowSV);   //大小
			lv_label_set_text_fmt(labely2, "PV: %.1f", curveData[point].flowPV);  //大小
		}
	}
    else if (target == newPosBtn)
    {
    	cont_width = lv_obj_get_content_width(flowChart);
    	if (flowDistance < cont_width * (flowMultiple - 1))
    	{
    		lv_obj_clear_state(oldPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    		flowDistance += nowPoint.x - lastPoint.x;
    		lv_obj_scroll_to_x(flowChart, flowDistance, LV_ANIM_OFF);
    		lv_chart_refresh(flowChart);
    	}
    	else
    	{
    		lv_obj_add_state(newPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    	}

    }
    else if (target == oldPosBtn)
    {
    	if (flowDistance > 0)
    	{
    		lv_obj_clear_state(newPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    		flowDistance -= nowPoint.x - lastPoint.x;
    		lv_obj_scroll_to_x(flowChart, flowDistance, LV_ANIM_OFF);
    		lv_chart_refresh(flowChart);
    	}
    	else
    	{
    		lv_obj_add_state(oldPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    	}
    }
    else if (target == enlargeBtn)
    {

    	if (flowZoom < DEFAULT_CURVE_MAX_MULTIPLE)
    	{
    		lv_obj_clear_state(reduceBtn, LV_STATE_DISABLED);    // 清除禁用状态
    		lv_obj_clear_state(newPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    		lv_obj_clear_state(oldPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用

    		flowZoom += LV_IMG_ZOOM_NONE;	//扩大一倍
    		flowMultiple = flowZoom / LV_IMG_ZOOM_NONE;
    		formCnt_x = flowMultiple * 4;
    		lv_chart_get_point_pos_by_id(flowChart, yser2, flowArrayPos, &lastPoint);
            lv_chart_set_zoom_x(flowChart, flowZoom);  				  //X轴缩放
    		lv_chart_get_point_pos_by_id(flowChart, yser2, flowArrayPos, &nowPoint);
    		flowDistance = (flowMultiple-1) * (nowPoint.x - lastPoint.x);
    		lv_chart_set_div_line_count(flowChart, 5, formCnt_x);  //重新分配分割线数量
        	printf("flowArrayPos: %d lastPoint: %d  nowPoint: %d \n",flowArrayPos, lastPoint.x, nowPoint.x);
            lv_obj_scroll_to_x(flowChart, (flowMultiple-1)*(nowPoint.x - lastPoint.x), LV_ANIM_OFF);
            lv_chart_refresh(flowChart);  //刷新
            if (flowZoom == DEFAULT_CURVE_MAX_MULTIPLE)
            {
            	lv_obj_add_state(enlargeBtn, LV_STATE_DISABLED);    // 达到最大值禁用
            }
    	}

    }
    else if (target == reduceBtn)
    {
    	if (flowZoom > LV_IMG_ZOOM_NONE)
    	{
    		lv_obj_clear_state(enlargeBtn, LV_STATE_DISABLED);  // 清除禁用状态
    		lv_obj_clear_state(newPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    		lv_obj_clear_state(oldPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    		flowZoom -= LV_IMG_ZOOM_NONE;	//缩小一倍
    		flowMultiple = flowZoom / LV_IMG_ZOOM_NONE;
    		formCnt_x = flowMultiple * 5;
    		lv_chart_get_point_pos_by_id(flowChart, yser2, flowArrayPos, &nowPoint);
            lv_chart_set_zoom_x(flowChart, flowZoom);  				  //X轴缩放
    		lv_chart_get_point_pos_by_id(flowChart, yser2, flowArrayPos, &lastPoint);
    		flowDistance = (flowMultiple-1) * (nowPoint.x - lastPoint.x);
    		lv_chart_set_div_line_count(flowChart, 5, formCnt_x);  //重新分配分割线数量
    		printf("flowArrayPos: %d lastPoint: %d  nowPoint: %d \n",flowArrayPos, lastPoint.x, nowPoint.x);
            lv_obj_scroll_to_x(flowChart, (flowMultiple - 1)*(nowPoint.x - lastPoint.x), LV_ANIM_OFF);
            lv_chart_refresh(flowChart);  //刷新
            if (flowZoom == LV_IMG_ZOOM_NONE)
            {
            	lv_obj_add_state(reduceBtn, LV_STATE_DISABLED);    // 达到最大值禁用
            }
    	}

    }
}
/**
* @brief 压力曲线部件事件回调
* @param *e ：事件相关参数的集合，它包含了该事件的所有数据
* @return 无
*/
void UI_press_curve_event_cb(lv_event_t* e) {

    lv_event_code_t code = lv_event_get_code(e);
    lv_obj_t* target = lv_event_get_target(e); /* 获取触发源 */
    uint8_t formCnt_x = 0;
    uint16_t deviation = 0;
    uint16_t point = 0;
	lv_coord_t cont_width;

	if (target == pressChart)  //温度图表部件
	{
		if (code == LV_EVENT_PRESSED)  //点击
		{
			pressArrayPos = lv_chart_get_pressed_point(pressChart); // 获取触摸点的索引
			lv_chart_set_cursor_point(pressChart, pressCursor, yser2, pressArrayPos);//设置光标到触摸点对应的数据点
			/* 计算定位点对应的数组元素 */
			deviation = CURVEDATASUM - 1 - bufPoint;
			if(pressArrayPos < deviation)
			{
				point = bufPoint + pressArrayPos + 1;
			}
			else
			{
				point = pressArrayPos - deviation;
			}
			/* 时间标签 */
			lv_label_set_text_fmt(labelx, "Time: %2d:%02d:%02d", curveData[point].chartTime.hour,\
					curveData[point].chartTime.min,curveData[point].chartTime.sec);  //时间
			/* 数值标签 */
			lv_label_set_text_fmt(labely1, "SV: %.1f", curveData[point].pressSV);   //大小
			lv_label_set_text_fmt(labely2, "PV1: %.1f", curveData[point].pressPV1);  //大小
			lv_label_set_text_fmt(labely3, "PV2: %.1f", curveData[point].pressPV2);  //大小
		}
	}
    else if (target == newPosBtn)
    {
    	cont_width = lv_obj_get_content_width(pressChart);
    	if (pressDistance < cont_width * (pressMultiple - 1))
    	{
    		lv_obj_clear_state(oldPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    		pressDistance += nowPoint.x - lastPoint.x;
    		lv_obj_scroll_to_x(pressChart, pressDistance, LV_ANIM_OFF);
    		lv_chart_refresh(pressChart);
    	}
    	else
    	{
    		lv_obj_add_state(newPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    	}

    }
    else if (target == oldPosBtn)
    {
    	if (pressDistance > 0)
    	{
    		lv_obj_clear_state(newPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    		pressDistance -= nowPoint.x - lastPoint.x;
    		lv_obj_scroll_to_x(pressChart, pressDistance, LV_ANIM_OFF);
    		lv_chart_refresh(pressChart);
    	}
    	else
    	{
    		lv_obj_add_state(oldPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    	}
    }
    else if (target == enlargeBtn)
    {

    	if (pressZoom < DEFAULT_CURVE_MAX_MULTIPLE)
    	{
    		lv_obj_clear_state(reduceBtn, LV_STATE_DISABLED);    // 清除禁用状态
    		lv_obj_clear_state(newPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    		lv_obj_clear_state(oldPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用

    		pressZoom += LV_IMG_ZOOM_NONE * 5;	//扩大一倍
    		pressMultiple = pressZoom / LV_IMG_ZOOM_NONE;
    		formCnt_x = pressMultiple * 5;
    		lv_chart_get_point_pos_by_id(pressChart, yser2, pressArrayPos, &lastPoint);
            lv_chart_set_zoom_x(pressChart, pressZoom);  				  //X轴缩放
    		lv_chart_get_point_pos_by_id(pressChart, yser2, pressArrayPos, &nowPoint);
    		pressDistance = (pressMultiple / 5) * (nowPoint.x - lastPoint.x);
    		lv_chart_set_div_line_count(pressChart, 5, formCnt_x);  //重新分配分割线数量
        	printf("pressArrayPos: %d lastPoint: %d  nowPoint: %d \n",pressArrayPos, lastPoint.x, nowPoint.x);
            lv_obj_scroll_to_x(pressChart, (pressMultiple / 5)*(nowPoint.x - lastPoint.x), LV_ANIM_OFF);
            lv_chart_refresh(pressChart);  //刷新
            if (pressZoom == DEFAULT_CURVE_MAX_MULTIPLE)
            {
            	lv_obj_add_state(enlargeBtn, LV_STATE_DISABLED);    // 达到最大值禁用
            }
    	}

    }
    else if (target == reduceBtn)
    {
    	if (pressZoom > LV_IMG_ZOOM_NONE)
    	{
    		lv_obj_clear_state(enlargeBtn, LV_STATE_DISABLED);  // 清除禁用状态
    		lv_obj_clear_state(newPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    		lv_obj_clear_state(oldPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
    		pressZoom -= LV_IMG_ZOOM_NONE * 5;	//缩小一倍
    		pressMultiple = pressZoom / LV_IMG_ZOOM_NONE;
    		formCnt_x = pressMultiple * 5;
    		lv_chart_get_point_pos_by_id(pressChart, yser2, pressArrayPos, &nowPoint);
            lv_chart_set_zoom_x(pressChart, pressZoom);  				  //X轴缩放
    		lv_chart_get_point_pos_by_id(pressChart, yser2, pressArrayPos, &lastPoint);
    		pressDistance = (pressMultiple / 5) * (nowPoint.x - lastPoint.x);
    		lv_chart_set_div_line_count(pressChart, 5, formCnt_x);  //重新分配分割线数量
    		printf("pressArrayPos: %d lastPoint: %d  nowPoint: %d \n",pressArrayPos, lastPoint.x, nowPoint.x);
            lv_obj_scroll_to_x(pressChart, (pressMultiple / 5)*(nowPoint.x - lastPoint.x), LV_ANIM_OFF);
            lv_chart_refresh(pressChart);  //刷新
            if (pressZoom <= LV_IMG_ZOOM_NONE)
            {
            	lv_obj_add_state(reduceBtn, LV_STATE_DISABLED);    // 达到最大值禁用
            }
    	}

    }
}
/**
* @brief 温度曲线更新数据定时器回调  1S
* @param *e ：事件相关参数的集合，它包含了该事件的所有数据
* @return 无
*/
void UI_temp_timer_event_cb(lv_timer_t* timer)
{
	LV_UNUSED(timer);
//	static uint8_t tempRefreshFlag;
//	static struct chartData tempRefreshBuff[DEFAULT_CURVE_REFRESH_TIME];
	/* 加载数据 */
	if(flag < 2)
	{
		if(flag == 1)
		{
			if(g_RW_State == RW_READY)  //读取完数据
			{
				/* 分离数据给外部数组 */
				bufPoint = 0;
				while(bufPoint < CURVEDATASUM)
				{
					dataBuf1[bufPoint] = (lv_coord_t)(curveData[bufPoint].tempSV * 100);
					dataBuf2[bufPoint] = (lv_coord_t)(curveData[bufPoint].tempPV1 * 100);
					dataBuf3[bufPoint] = (lv_coord_t)(curveData[bufPoint].tempPV2 * 100);
					bufPoint++;
				}
				bufPoint--;
				/* 添加外部数组 */

				lv_chart_set_ext_y_array(tempChart, yser1, (lv_coord_t*)dataBuf1);
				lv_chart_set_ext_y_array(tempChart, yser2, (lv_coord_t*)dataBuf2);
				lv_chart_set_ext_y_array(tempChart, yser3, (lv_coord_t*)dataBuf3);
				lv_obj_add_state(newPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
				tempDistance = lv_obj_get_content_width(tempChart) * (tempMultiple - 1);
				lv_obj_scroll_to_x(tempChart, tempDistance, LV_ANIM_OFF);  // 回到最新位置
				/* 更新曲线 */
				lv_chart_refresh(tempChart);
				flag = 2;
				/* 设置计时器周期为1S */
				lv_timer_set_period(timer, 1000);  //更改定时器周期为1S
			}
		}
		else
		{
			if (g_RW_State == RW_READY)  //再次读取
			{
				g_RW_State = RW_READ_NAND_CURVE;  //读取线
				flag = 1;
			}
		}
	}
	else
	{
		/* 刷新文本框 */
		refresh_textarea();
		/* 判断上下限是否合法*/
		if (tempChartyMin >= tempChartyMax)
		{
			tempChartyMax = lastMaxScale;
			tempChartyMin = lastMinScale;
		}
		/* 更新曲线上下限*/
		if (lastMinScale != tempChartyMin || lastMaxScale != tempChartyMax)
		{
			lastMinScale = tempChartyMin;
			lastMaxScale = tempChartyMax;
			lv_chart_set_range(tempChart, LV_CHART_AXIS_PRIMARY_Y, tempChartyMin * 100, tempChartyMax * 100);
		}
	    if (bufPoint < (CURVEDATASUM - 1))
	    {
	    	bufPoint++;
	    }
	    else
	    {
	    	bufPoint = 0;
	    }

		curveData[bufPoint].chartTime = DS.clockTime;       //时间
		curveData[bufPoint].tempSV =  UP.SV_Temp1;//设置温度
		curveData[bufPoint].tempPV1 = UP.mainTempDisplay;//主温度
		curveData[bufPoint].tempPV2 = UP.subTempDisplay;//辅温度
//		curveData[bufPoint].tempSV =  (int)(UP.SV_Temp1 * 10 + 0.5)/10.0;//设置温度
//		curveData[bufPoint].tempPV1 = (int)(UP.mainTempDisplay * 10 + 0.5)/10.0;//主温度
//		curveData[bufPoint].tempPV2 = (int)(UP.subTempDisplay * 10 + 0.5)/10.0;//辅温度

		lv_chart_set_next_value(tempChart, yser1, (lv_coord_t)(curveData[bufPoint].tempSV * 100));   //填充数据到数据序列1
		lv_chart_set_next_value(tempChart, yser2, (lv_coord_t)(curveData[bufPoint].tempPV1 * 100));  //填充数据到数据序列2
		lv_chart_set_next_value(tempChart, yser3, (lv_coord_t)(curveData[bufPoint].tempPV2 * 100));  //填充数据到数据序列3
		lv_chart_refresh(tempChart);
//		if (tempRefreshFlag < DEFAULT_CURVE_REFRESH_TIME)
//		{
//			tempRefreshBuff[tempRefreshFlag++] = curveData[bufPoint];
//		}
//		else
//		{
//			for ( ;tempRefreshFlag > 0; tempRefreshFlag--)
//			{
//				lv_chart_set_next_value(tempChart, yser1, \
//						(lv_coord_t)(tempRefreshBuff[DEFAULT_CURVE_REFRESH_TIME - tempRefreshFlag].tempSV * 100));   //填充数据到数据序列1
//				lv_chart_set_next_value(tempChart, yser2, \
//						(lv_coord_t)(tempRefreshBuff[DEFAULT_CURVE_REFRESH_TIME - tempRefreshFlag].tempPV1 * 100));  //填充数据到数据序列2
//				lv_chart_set_next_value(tempChart, yser3, \
//						(lv_coord_t)(tempRefreshBuff[DEFAULT_CURVE_REFRESH_TIME - tempRefreshFlag].tempPV2 * 100));  //填充数据到数据序列3
//			}
//			lv_chart_refresh(tempChart);
//		}
	}
}
/**
* @brief 流量曲线更新数据定时器回调  1S
* @param *e ：事件相关参数的集合，它包含了该事件的所有数据
* @return 无
*/
void UI_flow_timer_event_cb(lv_timer_t* timer)
{
	LV_UNUSED(timer);
	/* 加载数据 */
	if(flag < 2)
	{
		if(flag == 1)
		{
			if(g_RW_State == RW_READY)  //读取完数据
			{
				/* 分离数据给外部数组 */
				bufPoint = 0;
				while(bufPoint < CURVEDATASUM)
				{
					dataBuf1[bufPoint] = (lv_coord_t)(curveData[bufPoint].flowSV);
					dataBuf2[bufPoint] = (lv_coord_t)(curveData[bufPoint].flowPV);
					bufPoint++;
				}
				bufPoint--;
				/* 添加外部数组 */
				lv_chart_set_ext_y_array(flowChart, yser1, (lv_coord_t*)dataBuf1);
				lv_chart_set_ext_y_array(flowChart, yser2, (lv_coord_t*)dataBuf2);
				/* 更新曲线 */
				lv_chart_refresh(flowChart);
				flag = 2;
				/* 设置计时器周期为1S */
				lv_timer_set_period(timer, 1000);  //更改定时器周期为1S
			}
		}
		else
		{
			if (g_RW_State == RW_READY)  //再次读取
			{
				g_RW_State = RW_READ_NAND_CURVE;  //读取线
				flag = 1;
			}
		}
	}
	else
	{
		/* 刷新文本框 */
		refresh_textarea();
		/* 判断上下限是否合法*/
		if (flowChartyMin >= flowChartyMax)
		{
			flowChartyMax = lastMaxScale;
			flowChartyMin = lastMinScale;
		}
		/* 更新曲线上下限*/
		if (lastMinScale != flowChartyMin || lastMaxScale != flowChartyMax)
		{
			lastMinScale = flowChartyMin;
			lastMaxScale = flowChartyMax;
			lv_chart_set_range(flowChart, LV_CHART_AXIS_PRIMARY_Y, flowChartyMin, flowChartyMax);
		}
	    if (bufPoint < (CURVEDATASUM - 1))
	    {
	    	bufPoint++;
	    }
	    else
	    {
	    	bufPoint = 0;
	    }

		curveData[bufPoint].chartTime = DS.clockTime;       //时间
		curveData[bufPoint].flowSV = UP.SV_Flow;            //设置流量
		curveData[bufPoint].flowPV = UP.flowDisplay;        //实际流量

		lv_chart_set_next_value(flowChart, yser1, (lv_coord_t)(curveData[bufPoint].flowSV));   //填充数据到数据序列1
		lv_chart_set_next_value(flowChart, yser2, (lv_coord_t)(curveData[bufPoint].flowPV));  //填充数据到数据序列2
		lv_chart_refresh(flowChart);
	}
}
/**
* @brief 压力曲线更新数据定时器回调  1S
* @param *e ：事件相关参数的集合，它包含了该事件的所有数据
* @return 无
*/
void UI_press_timer_event_cb(lv_timer_t* timer)
{
	LV_UNUSED(timer);
	/* 加载数据 */
	if(flag < 2)
	{
		if(flag == 1)
		{
			if(g_RW_State == RW_READY)  //读取完数据
			{
				/* 分离数据给外部数组 */
				bufPoint = 0;
				while(bufPoint < CURVEDATASUM)
				{
					dataBuf1[bufPoint] = (lv_coord_t)(curveData[bufPoint].pressSV);
					dataBuf2[bufPoint] = (lv_coord_t)(curveData[bufPoint].pressPV1);
					dataBuf3[bufPoint] = (lv_coord_t)(curveData[bufPoint].pressPV2);
					bufPoint++;
				}
				bufPoint--;
				/* 添加外部数组 */
				lv_chart_set_ext_y_array(pressChart, yser1, (lv_coord_t*)dataBuf1);
				lv_chart_set_ext_y_array(pressChart, yser2, (lv_coord_t*)dataBuf2);
				lv_chart_set_ext_y_array(pressChart, yser3, (lv_coord_t*)dataBuf3);
				lv_obj_add_state(newPosBtn, LV_STATE_DISABLED);    // 达到最大值禁用
				pressDistance = lv_obj_get_content_width(pressChart) * (pressMultiple - 1);
				lv_obj_scroll_to_x(pressChart, pressDistance, LV_ANIM_OFF);  // 回到最新位置
				/* 更新曲线 */
				lv_chart_refresh(pressChart);
				flag = 2;
				/* 设置计时器周期为1S */
				lv_timer_set_period(timer, 1000);  //更改定时器周期为1S
			}
		}
		else
		{
			if (g_RW_State == RW_READY)  //再次读取
			{
				g_RW_State = RW_READ_NAND_CURVE;  //读取线
				flag = 1;
			}
		}
	}
	else
	{
		/* 刷新文本框 */
		refresh_textarea();
		/* 判断上下限是否合法*/
		if (pressChartyMin >= pressChartyMax)
		{
			pressChartyMax = lastMaxScale;
			pressChartyMin = lastMinScale;
		}
		/* 更新曲线上下限*/
		if (lastMinScale != pressChartyMin || lastMaxScale != pressChartyMax)
		{
			lastMinScale = pressChartyMin;
			lastMaxScale = pressChartyMax;
			lv_chart_set_range(pressChart, LV_CHART_AXIS_PRIMARY_Y, pressChartyMin, pressChartyMax);
		}
	    if (bufPoint < (CURVEDATASUM - 1))
	    {
	    	bufPoint++;
	    }
	    else
	    {
	    	bufPoint = 0;
	    }

		curveData[bufPoint].chartTime = DS.clockTime;       //时间
		curveData[bufPoint].pressSV = UP.SV_Press;           //设置温度
		curveData[bufPoint].pressPV1 = UP.outPressDisplay;   //出液压力显示值
		curveData[bufPoint].pressPV2 = UP.inPressDisplay;    //回液压力显示值

		lv_chart_set_next_value(pressChart, yser1, \
				(lv_coord_t)curveData[bufPoint].pressSV);   //填充数据到数据序列1
		lv_chart_set_next_value(pressChart, yser2, \
				(lv_coord_t)curveData[bufPoint].pressPV1);  //填充数据到数据序列2
		lv_chart_set_next_value(pressChart, yser3, \
				(lv_coord_t)curveData[bufPoint].pressPV2);  //填充数据到数据序列3
		lv_chart_refresh(pressChart);

	}
}
/**
  * @brief  温度曲线界面纵坐标重新绘制
  * @param  无
  * @retval 无
  */
static void draw_event_cb(lv_event_t * e)
{
	char axisText[10];
    lv_obj_draw_part_dsc_t * dsc = lv_event_get_draw_part_dsc(e);
    if(!lv_obj_draw_part_check_type(dsc, &lv_chart_class, LV_CHART_DRAW_PART_TICK_LABEL)) return;

    if(dsc->id == LV_CHART_AXIS_PRIMARY_Y && dsc->text) {
        float axis = atof(dsc->text);
        snprintf(axisText, sizeof(axisText), "%.1f", axis / 100);
        lv_snprintf(dsc->text, dsc->text_length, "%s", axisText);
    }
}

/**
  * @brief  温度曲线界面创建
  * @param  无
  * @retval 无
  */
void UI_create_curve_temp(void)
{

	/* 初始化上下限 */
	tempChartyMin = (lv_coord_t)FP.LL_TempFF;
	tempChartyMax = (lv_coord_t)FP.HL_TempFF;
	/* 读历史数据 */
	if (g_RW_State == RW_READY)
	{
		g_RW_State = RW_READ_NAND_CURVE;  //读取线
		flag = 1;
	}
    /* 主界面父对象 */
    parentObj = lv_obj_create(lv_scr_act());  //创建父对象
    lv_obj_add_style(parentObj, &style_parentObj, LV_STATE_DEFAULT);  //添加父对象为无填充样式
    lv_obj_set_size(parentObj, lv_pct(100), lv_pct(87));  //设置父对象的大小
    lv_obj_align(parentObj, LV_ALIGN_TOP_MID, lv_pct(0), lv_pct(13));  //设置父对象的位置
	/* 上下限输入框结构体初始化 */
	textarea_init(&tempChartyMin, &tempChartyMax);
    /*创建上下限输入框 */
	for(uint8_t i = 0; i < 2; i++)
	{
		textarea_create_by(parentObj, &taUser_textarea[i]);
	}

    /* 温度图表部件 */
	tempChart = lv_chart_create(parentObj);  //创建温度图表部件
	lv_obj_set_size(tempChart, lv_pct(70), lv_pct(75)); // 设置图表的大小
    lv_obj_align(tempChart, LV_ALIGN_TOP_LEFT, lv_pct(8), lv_pct(10));  //位置
    lv_chart_set_type(tempChart, LV_CHART_TYPE_LINE); // 设置图表类型为折线图
    lv_obj_set_style_bg_opa(tempChart, 0, LV_PART_INDICATOR);  //设置点的透明度
    lv_obj_set_style_line_width(tempChart, 3, LV_PART_ITEMS);  //设置曲线的粗细
    lv_chart_set_point_count(tempChart, CURVEDATASUM); // 设置图表点的数量
    lv_chart_set_zoom_x(tempChart, tempZoom);
    lv_chart_set_update_mode(tempChart, LV_CHART_UPDATE_MODE_SHIFT);  //循环模式
    lv_chart_set_range(tempChart, LV_CHART_AXIS_PRIMARY_Y, \
    		tempChartyMin * 100, tempChartyMax * 100); // 设置Y轴的范围
    lv_chart_set_axis_tick(tempChart, LV_CHART_AXIS_PRIMARY_Y, 3, 5, 5, 1, true, 85);
    lv_obj_set_style_text_font(tempChart, &lv_font_montserrat_20, LV_STATE_DEFAULT);
    lv_chart_set_div_line_count(tempChart, 5, tempMultiple * 5);  //重新分配分割线数量
    yser1 = lv_chart_add_series(tempChart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y); // 添加一个红色数据系列
    yser2 = lv_chart_add_series(tempChart, lv_palette_main(LV_PALETTE_BLUE), LV_CHART_AXIS_PRIMARY_Y); // 添加一个蓝色数据系列
    yser3 = lv_chart_add_series(tempChart, lv_palette_main(LV_PALETTE_GREEN), LV_CHART_AXIS_PRIMARY_Y); // 添加一个绿色数据系列
    lv_obj_clear_flag(tempChart, LV_OBJ_FLAG_SCROLL_MOMENTUM);  //禁止滑动惯性
    tempCursor = lv_chart_add_cursor(tempChart, lv_palette_main(LV_PALETTE_GREY), LV_DIR_VER);
    lv_obj_set_style_line_width(tempChart, 3, LV_PART_CURSOR);
    lv_chart_set_cursor_point(tempChart, tempCursor, yser2, tempArrayPos); //设置光标到触摸点对应的数据点
    lv_obj_add_event_cb(tempChart, UI_temp_curve_event_cb, LV_EVENT_ALL, NULL);  //添加事件
    lv_obj_add_event_cb(tempChart, draw_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL);
    lv_obj_scroll_to_x(tempChart, tempDistance, LV_ANIM_OFF);  // 回到最新位置

    /* 回到最新位置按钮 */
    newPosBtn = lv_btn_create(parentObj);  //数据导出按钮
    lv_obj_set_style_bg_color(newPosBtn, lv_color_hex(0x3a96f1), LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(newPosBtn, lv_color_hex(0xcfcfcf), LV_STATE_DISABLED);
    lv_obj_align(newPosBtn, LV_ALIGN_TOP_LEFT, lv_pct(70), lv_pct(85));  //位置
    lv_obj_add_event_cb(newPosBtn, UI_temp_curve_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 标签 */
    lv_obj_t * label = lv_label_create(newPosBtn);  //数据导出标签
    lv_obj_align_to(label, newPosBtn, LV_ALIGN_CENTER, 0, 0);  //位置
    lv_label_set_text(label, LV_SYMBOL_RIGHT);  //文本内容

    /* 回到开始位置按钮 */
    oldPosBtn = lv_btn_create(parentObj);  //数据导出按钮
    lv_obj_set_style_bg_color(oldPosBtn, lv_color_hex(0x3a96f1), LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(oldPosBtn, lv_color_hex(0xcfcfcf), LV_STATE_DISABLED);
    lv_obj_align(oldPosBtn, LV_ALIGN_TOP_LEFT, lv_pct(60), lv_pct(85));  //位置
    lv_obj_add_event_cb(oldPosBtn, UI_temp_curve_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 开始标签 */
    label = lv_label_create(oldPosBtn);  //数据导出标签
    lv_obj_align_to(label, oldPosBtn, LV_ALIGN_CENTER, 0, 0);  //位置
    lv_label_set_text(label, LV_SYMBOL_LEFT);  //文本内容
    /* 放大按钮 */
    enlargeBtn = lv_btn_create(parentObj);  //数据导出按钮
    lv_obj_align(enlargeBtn, LV_ALIGN_TOP_LEFT, lv_pct(40), lv_pct(85));  //位置
    lv_obj_set_style_bg_color(enlargeBtn, lv_color_hex(0x3a96f1), LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(enlargeBtn, lv_color_hex(0xcfcfcf), LV_STATE_DISABLED);
    lv_obj_add_event_cb(enlargeBtn, UI_temp_curve_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 标签 */
    label = lv_label_create(enlargeBtn);  //数据导出标签
    lv_obj_align_to(label, enlargeBtn, LV_ALIGN_CENTER, 0, 0);  //位置
    lv_label_set_text(label, LV_SYMBOL_PLUS);  //文本内容

    /* 缩小按钮 */
    reduceBtn = lv_btn_create(parentObj);  //数据导出按钮
    lv_obj_align(reduceBtn, LV_ALIGN_TOP_LEFT, lv_pct(50), lv_pct(85));  //位置
    lv_obj_set_style_bg_color(reduceBtn, lv_color_hex(0x3a96f1), LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(reduceBtn, lv_color_hex(0xcfcfcf), LV_STATE_DISABLED);
    lv_obj_add_event_cb(reduceBtn, UI_temp_curve_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 标签 */
    label = lv_label_create(reduceBtn);  //数据导出标签
    lv_obj_align_to(label, reduceBtn, LV_ALIGN_CENTER, 0, 0);  //位置
    lv_label_set_text(label, LV_SYMBOL_MINUS);  //文本内

    /* 创建标签 */
    label = lv_label_create(parentObj);  //数据导出标签
    lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);  //颜色
    lv_label_set_text(label, "上限:");  //文本内容
    lv_obj_align(label, LV_ALIGN_TOP_LEFT, lv_pct(79), lv_pct(10));  //位置

    label = lv_label_create(parentObj);  //数据导出标签
    lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);  //颜色
    lv_label_set_text(label, "下限:");  //文本内容
    lv_obj_align(label, LV_ALIGN_TOP_LEFT, lv_pct(79), lv_pct(31));  //位置
    /* 红色线条 */
    lv_obj_t * line = lv_line_create(parentObj);  //红色线条
    lv_obj_set_style_line_width(line, 5, LV_STATE_DEFAULT);  //宽度
    lv_obj_set_style_line_rounded(line,true,LV_STATE_DEFAULT);  //端点
    lv_obj_set_style_line_color(line, lv_palette_main(LV_PALETTE_RED), 0);  //颜色
    lv_obj_align(line, LV_ALIGN_TOP_LEFT, lv_pct(10), lv_pct(13));  //位置
    lv_line_set_points(line, line_points, 2);  //坐标点

    /* 红色标签 */
    labely1 = lv_label_create(parentObj);  //数据导出标签
	lv_label_set_text(labely1, "");
	lv_obj_set_style_text_font(labely1, &lv_font_montserrat_20, LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(labely1, lv_palette_main(LV_PALETTE_RED), LV_STATE_DEFAULT);
    lv_obj_align(labely1,  LV_ALIGN_TOP_LEFT, lv_pct(16), lv_pct(11));  //位置

    /* 蓝色线条 */
    line = lv_line_create(parentObj);  //红色线条
    lv_obj_set_style_line_width(line, 5, LV_STATE_DEFAULT);  //宽度
    lv_obj_set_style_line_rounded(line,true,LV_STATE_DEFAULT);  //端点
    lv_obj_set_style_line_color(line, lv_palette_main(LV_PALETTE_BLUE), 0);  //颜色
    lv_obj_align(line, LV_ALIGN_TOP_LEFT, lv_pct(10), lv_pct(19));  //位置
    lv_line_set_points(line, line_points, 2);  //坐标点

    /* 蓝色标签 */
    labely2 = lv_label_create(parentObj);
	lv_label_set_text(labely2, "");
	lv_obj_set_style_text_font(labely2, &lv_font_montserrat_20, LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(labely2, lv_palette_main(LV_PALETTE_BLUE), LV_STATE_DEFAULT);
    lv_obj_align(labely2,  LV_ALIGN_TOP_LEFT, lv_pct(16), lv_pct(17));  //位置

    /* 绿色线条 */
    line = lv_line_create(parentObj);  //红色线条
    lv_obj_set_style_line_width(line, 5, LV_STATE_DEFAULT);  //宽度
    lv_obj_set_style_line_rounded(line,true,LV_STATE_DEFAULT);  //端点
    lv_obj_set_style_line_color(line, lv_palette_main(LV_PALETTE_GREEN), 0);  //颜色
    lv_obj_align(line, LV_ALIGN_TOP_LEFT, lv_pct(10), lv_pct(25));  //位置
    lv_line_set_points(line, line_points, 2);  //坐标点

    /* 绿色标签 */
    labely3 = lv_label_create(parentObj);
 	lv_label_set_text(labely3, "");
 	lv_obj_set_style_text_font(labely3, &lv_font_montserrat_20, LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(labely3, lv_palette_main(LV_PALETTE_GREEN), LV_STATE_DEFAULT);
    lv_obj_align(labely3,  LV_ALIGN_TOP_LEFT, lv_pct(16), lv_pct(23));  //位置

    /* 时间显示标签 */
    labelx = lv_label_create(parentObj);  //创建时间标签
    lv_obj_set_style_text_font(labelx, &lv_font_montserrat_20, LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(labelx, lv_color_black(), LV_STATE_DEFAULT);
    lv_obj_align(labelx, LV_ALIGN_TOP_LEFT, lv_pct(9), lv_pct(29));  //位置
    lv_label_set_text(labelx, "");
    /* 温度曲线按钮 */
    tempCurveBtn = lv_btn_create(parentObj);  //创建工厂保护温度上限报警按钮
    lv_obj_set_size(tempCurveBtn, 132, 58);
    lv_obj_set_style_bg_color(tempCurveBtn, lv_color_hex(0x9c9c9c), LV_STATE_DEFAULT);  //点击颜色
	lv_obj_set_style_bg_img_src(tempCurveBtn, &dsc_ico_buff[10], LV_STATE_DEFAULT);
	lv_obj_set_style_bg_img_src(tempCurveBtn, &dsc_ico_buff[9], LV_STATE_CHECKED);
    lv_obj_align_to(tempCurveBtn, parentObj, LV_ALIGN_TOP_LEFT, lv_pct(81), lv_pct(65));  //位置
    lv_obj_add_state(tempCurveBtn, LV_STATE_CHECKED);
    lv_obj_add_event_cb(tempCurveBtn, UI_curve_btn_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 温度曲线按钮标签 */
    label = lv_label_create(tempCurveBtn);
    lv_label_set_text(label, dispText[DA.typeLanguage].temp);
    lv_obj_set_style_text_color(label, lv_color_hex(0x000000), LV_STATE_DEFAULT);
    lv_obj_align_to(label, tempCurveBtn, LV_ALIGN_CENTER, 0, 0);
//    /* 流量曲线按钮 */
//    flowCurveBtn = lv_btn_create(parentObj);  //创建工厂保护温度上限报警按钮
//    lv_obj_set_size(flowCurveBtn, 132, 58);
//    lv_obj_set_style_bg_color(flowCurveBtn, lv_color_hex(0x9c9c9c), LV_STATE_DEFAULT);  //点击颜色
//	lv_obj_set_style_bg_img_src(flowCurveBtn, &dsc_ico_buff[10], LV_STATE_DEFAULT);
//	lv_obj_set_style_bg_img_src(flowCurveBtn, &dsc_ico_buff[9], LV_STATE_CHECKED);
//    lv_obj_align_to(flowCurveBtn, parentObj, LV_ALIGN_TOP_LEFT, lv_pct(81), lv_pct(65));  //位置
//    lv_obj_add_event_cb(flowCurveBtn, UI_curve_btn_event_cb, LV_EVENT_CLICKED, NULL);  //事件
//    /* 流量曲线按钮标签 */
//    label = lv_label_create(flowCurveBtn);
//    lv_label_set_text(label, dispText[DA.typeLanguage].Flow);
//    lv_obj_set_style_text_color(label, lv_color_hex(0x000000), LV_STATE_DEFAULT);
//    lv_obj_align_to(label, flowCurveBtn, LV_ALIGN_CENTER, 0, 0);
	/* 压力曲线按钮 */
    pressCurveBtn = lv_btn_create(parentObj);  //创建工厂保护温度上限报警按钮
    lv_obj_set_size(pressCurveBtn, 132, 58);
    lv_obj_set_style_bg_color(pressCurveBtn, lv_color_hex(0x9c9c9c), LV_STATE_DEFAULT);  //点击颜色
	lv_obj_set_style_bg_img_src(pressCurveBtn, &dsc_ico_buff[10], LV_STATE_DEFAULT);
	lv_obj_set_style_bg_img_src(pressCurveBtn, &dsc_ico_buff[9], LV_STATE_CHECKED);
	lv_obj_align_to(pressCurveBtn, parentObj, LV_ALIGN_TOP_LEFT, lv_pct(81), lv_pct(80));  //位置
	lv_obj_add_event_cb(pressCurveBtn, UI_curve_btn_event_cb, LV_EVENT_CLICKED, NULL);  //事件
	/* 压力曲线按钮标签 */
	label = lv_label_create(pressCurveBtn);
	lv_label_set_text(label, dispText[DA.typeLanguage].press);
	lv_obj_set_style_text_color(label, lv_color_hex(0x000000), LV_STATE_DEFAULT);
	lv_obj_align_to(label, pressCurveBtn, LV_ALIGN_CENTER, 0, 0);
    /* 数据导出按钮 */
    dataExportBtn = lv_btn_create(parentObj);  //数据导出按钮
    lv_obj_align(dataExportBtn, LV_ALIGN_TOP_LEFT, lv_pct(8), lv_pct(85));  //位置
    lv_obj_set_style_bg_color(dataExportBtn, lv_color_hex(0x3a96f1), LV_STATE_DEFAULT);
    lv_obj_add_event_cb(dataExportBtn, UI_curve_btn_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 数据导出标签 */
    label = lv_label_create(dataExportBtn);  //数据导出标签
    lv_obj_align_to(label, dataExportBtn, LV_ALIGN_CENTER, 0, 0);  //位置
    lv_label_set_text(label, LV_SYMBOL_USB);  //文本内容

    if (tempZoom == LV_IMG_ZOOM_NONE)
    {
    	lv_obj_add_state(reduceBtn, LV_STATE_DISABLED);
    	lv_obj_add_state(newPosBtn, LV_STATE_DISABLED);
    	lv_obj_add_state(oldPosBtn, LV_STATE_DISABLED);
    }
    else if (tempZoom == DEFAULT_CURVE_MAX_MULTIPLE)
    {
    	lv_obj_add_state(enlargeBtn, LV_STATE_DISABLED);
    }

    /* 曲线定时器 */
    timer = lv_timer_create(UI_temp_timer_event_cb, 100, NULL);  //100mS触发一次
}

/**
  * @brief  流量曲线界面创建
  * @param  无
  * @retval 无
  */
void UI_create_curve_flow(void)
{

	/* 初始化上下限 */
	flowChartyMin = DEFAULT_FLOWCURVE_DOWN;
	flowChartyMax = DEFAULT_FLOWCURVE_UP;
	/* 读历史数据 */
	if (g_RW_State == RW_READY) {
		g_RW_State = RW_READ_NAND_CURVE;  //读取线
		flag = 1;
	}
	/* 主界面父对象 */
	parentObj = lv_obj_create(lv_scr_act());  //创建父对象
	lv_obj_add_style(parentObj, &style_parentObj, LV_STATE_DEFAULT); //添加父对象为无填充样式
	lv_obj_set_size(parentObj, lv_pct(100), lv_pct(87));  //设置父对象的大小
	lv_obj_align(parentObj, LV_ALIGN_TOP_MID, lv_pct(0), lv_pct(13)); //设置父对象的位置
	/* 上下限输入框结构体初始化 */
	textarea_init(&flowChartyMin, &flowChartyMax);
	/*创建上下限输入框 */
	for (uint8_t i = 0; i < 2; i++) {
		textarea_create_by(parentObj, &taUser_textarea[i]);
	}

	/* 温度图表部件 */
	flowChart = lv_chart_create(parentObj);  //创建温度图表部件
	lv_chart_set_type(flowChart, LV_CHART_TYPE_LINE); // 设置图表类型为折线图
	lv_obj_set_size(flowChart, lv_pct(70), lv_pct(75)); // 设置图表的大小
	lv_chart_set_update_mode(flowChart, LV_CHART_UPDATE_MODE_SHIFT);  //循环模式
	lv_obj_set_style_line_width(flowChart, 3, LV_PART_ITEMS);  //设置曲线的粗细
	lv_chart_set_div_line_count(flowChart, 5, flowMultiple * 5);  //重新分配分割线数量
	lv_chart_set_zoom_x(flowChart, flowZoom);
	lv_chart_set_range(flowChart, LV_CHART_AXIS_PRIMARY_Y, flowChartyMin,
			flowChartyMax); // 设置Y轴的范围
	lv_obj_align(flowChart, LV_ALIGN_TOP_LEFT, lv_pct(8), lv_pct(10));  //位置
	lv_obj_set_style_line_width(flowChart, 3, LV_PART_ITEMS);  //设置曲线的粗细
	flowCursor = lv_chart_add_cursor(flowChart,
			lv_palette_main(LV_PALETTE_GREY), LV_DIR_VER);
	lv_obj_set_style_line_width(flowChart, 3, LV_PART_CURSOR);
	lv_obj_scroll_to_x(flowChart, flowDistance, LV_ANIM_OFF);  // 回到最新位置
	lv_chart_set_axis_tick(flowChart, LV_CHART_AXIS_PRIMARY_Y, 3, 5, 5, 1, true,
			85);

	/* 添加数据 */
	lv_obj_set_style_size(flowChart, 0, LV_PART_INDICATOR);
	yser1 = lv_chart_add_series(flowChart, lv_palette_main(LV_PALETTE_RED),
			LV_CHART_AXIS_PRIMARY_Y); // 添加一个红色数据系列
	yser2 = lv_chart_add_series(flowChart, lv_palette_main(LV_PALETTE_BLUE),
			LV_CHART_AXIS_PRIMARY_Y); // 添加一个蓝色数据系列
	yser3 = lv_chart_add_series(flowChart, lv_palette_main(LV_PALETTE_GREEN),
			LV_CHART_AXIS_PRIMARY_Y); // 添加一个绿色数据系列
	lv_chart_set_ext_y_array(flowChart, yser1, (lv_coord_t*) dataBuf1); // 设置外部数组
	lv_chart_set_ext_y_array(flowChart, yser2, (lv_coord_t*) dataBuf2); // 设置外部数组
	lv_chart_set_point_count(flowChart, CURVEDATASUM); // 设置图表点的数量
	lv_obj_add_event_cb(flowChart, UI_flow_curve_event_cb, LV_EVENT_ALL, NULL); //添加事件
	lv_chart_set_cursor_point(flowChart, flowCursor, yser2, flowArrayPos); //设置光标到触摸点对应的数据点
	lv_obj_clear_flag(flowChart, LV_OBJ_FLAG_SCROLL_MOMENTUM);  //禁止滑动惯性
	lv_chart_refresh(flowChart);
	/* 回到最新位置按钮 */
	newPosBtn = lv_btn_create(parentObj);  //数据导出按钮
	lv_obj_set_style_bg_color(newPosBtn, lv_color_hex(0x3a96f1),
			LV_STATE_DEFAULT);
	lv_obj_set_style_bg_color(newPosBtn, lv_color_hex(0xcfcfcf),
			LV_STATE_DISABLED);
	lv_obj_align(newPosBtn, LV_ALIGN_TOP_LEFT, lv_pct(70), lv_pct(85));  //位置
	lv_obj_add_event_cb(newPosBtn, UI_flow_curve_event_cb, LV_EVENT_CLICKED,
			NULL);  //事件
	/* 标签 */
	lv_obj_t *label = lv_label_create(newPosBtn);  //数据导出标签
	lv_obj_align_to(label, newPosBtn, LV_ALIGN_CENTER, 0, 0);  //位置
	lv_label_set_text(label, LV_SYMBOL_RIGHT);  //文本内容

	/* 回到开始位置按钮 */
	oldPosBtn = lv_btn_create(parentObj);  //数据导出按钮
	lv_obj_set_style_bg_color(oldPosBtn, lv_color_hex(0x3a96f1),
			LV_STATE_DEFAULT);
	lv_obj_set_style_bg_color(oldPosBtn, lv_color_hex(0xcfcfcf),
			LV_STATE_DISABLED);
	lv_obj_align(oldPosBtn, LV_ALIGN_TOP_LEFT, lv_pct(60), lv_pct(85));  //位置
	lv_obj_add_event_cb(oldPosBtn, UI_flow_curve_event_cb, LV_EVENT_CLICKED,
			NULL);  //事件
	/* 开始标签 */
	label = lv_label_create(oldPosBtn);  //数据导出标签
	lv_obj_align_to(label, oldPosBtn, LV_ALIGN_CENTER, 0, 0);  //位置
	lv_label_set_text(label, LV_SYMBOL_LEFT);  //文本内容
	/* 放大按钮 */
	enlargeBtn = lv_btn_create(parentObj);  //数据导出按钮
	lv_obj_align(enlargeBtn, LV_ALIGN_TOP_LEFT, lv_pct(40), lv_pct(85));  //位置
	lv_obj_set_style_bg_color(enlargeBtn, lv_color_hex(0x3a96f1),
			LV_STATE_DEFAULT);
	lv_obj_set_style_bg_color(enlargeBtn, lv_color_hex(0xcfcfcf),
			LV_STATE_DISABLED);
	lv_obj_add_event_cb(enlargeBtn, UI_flow_curve_event_cb, LV_EVENT_CLICKED,
			NULL);  //事件
	/* 标签 */
	label = lv_label_create(enlargeBtn);  //数据导出标签
	lv_obj_align_to(label, enlargeBtn, LV_ALIGN_CENTER, 0, 0);  //位置
	lv_label_set_text(label, LV_SYMBOL_PLUS);  //文本内容

	/* 缩小按钮 */
	reduceBtn = lv_btn_create(parentObj);  //数据导出按钮
	lv_obj_align(reduceBtn, LV_ALIGN_TOP_LEFT, lv_pct(50), lv_pct(85));  //位置
	lv_obj_set_style_bg_color(reduceBtn, lv_color_hex(0x3a96f1),
			LV_STATE_DEFAULT);
	lv_obj_set_style_bg_color(reduceBtn, lv_color_hex(0xcfcfcf),
			LV_STATE_DISABLED);
	lv_obj_add_event_cb(reduceBtn, UI_flow_curve_event_cb, LV_EVENT_CLICKED,
			NULL);  //事件
	/* 标签 */
	label = lv_label_create(reduceBtn);  //数据导出标签
	lv_obj_align_to(label, reduceBtn, LV_ALIGN_CENTER, 0, 0);  //位置
	lv_label_set_text(label, LV_SYMBOL_MINUS);  //文本内

	/* 创建标签 */
	label = lv_label_create(parentObj);  //数据导出标签
	lv_obj_set_style_text_color(label, lv_color_hex(0xffffff),
			LV_STATE_DEFAULT);  //颜色
	lv_label_set_text(label, "上限:");  //文本内容
	lv_obj_align(label, LV_ALIGN_TOP_LEFT, lv_pct(79), lv_pct(10));  //位置

	label = lv_label_create(parentObj);  //数据导出标签
	lv_obj_set_style_text_color(label, lv_color_hex(0xffffff),
			LV_STATE_DEFAULT);  //颜色
	lv_label_set_text(label, "下限:");  //文本内容
	lv_obj_align(label, LV_ALIGN_TOP_LEFT, lv_pct(79), lv_pct(31));  //位置
	/* 红色线条 */
	lv_obj_t * line = lv_line_create(parentObj);  //红色线条
	lv_obj_set_style_line_width(line, 5, LV_STATE_DEFAULT);  //宽度
	lv_obj_set_style_line_rounded(line, true, LV_STATE_DEFAULT);  //端点
	lv_obj_set_style_line_color(line, lv_palette_main(LV_PALETTE_RED), 0); //颜色
	lv_obj_align(line, LV_ALIGN_TOP_LEFT, lv_pct(10), lv_pct(13));  //位置
	lv_line_set_points(line, line_points, 2);  //坐标点

	/* 红色标签 */
	labely1 = lv_label_create(parentObj);  //数据导出标签
	lv_label_set_text(labely1, "");
	lv_obj_set_style_text_font(labely1, &lv_font_montserrat_20,
			LV_STATE_DEFAULT);
	lv_obj_set_style_text_color(labely1, lv_palette_main(LV_PALETTE_RED),
			LV_STATE_DEFAULT);
	lv_obj_align(labely1, LV_ALIGN_TOP_LEFT, lv_pct(16), lv_pct(11));  //位置

	/* 蓝色线条 */
	line = lv_line_create(parentObj);  //红色线条
	lv_obj_set_style_line_width(line, 5, LV_STATE_DEFAULT);  //宽度
	lv_obj_set_style_line_rounded(line, true, LV_STATE_DEFAULT);  //端点
	lv_obj_set_style_line_color(line, lv_palette_main(LV_PALETTE_BLUE), 0); //颜色
	lv_obj_align(line, LV_ALIGN_TOP_LEFT, lv_pct(10), lv_pct(19));  //位置
	lv_line_set_points(line, line_points, 2);  //坐标点

	/* 蓝色标签 */
	labely2 = lv_label_create(parentObj);
	lv_label_set_text(labely2, "");
	lv_obj_set_style_text_font(labely2, &lv_font_montserrat_20,
			LV_STATE_DEFAULT);
	lv_obj_set_style_text_color(labely2, lv_palette_main(LV_PALETTE_BLUE),
			LV_STATE_DEFAULT);
	lv_obj_align(labely2, LV_ALIGN_TOP_LEFT, lv_pct(16), lv_pct(17));  //位置

	/* 时显示标签 */
	labelx = lv_label_create(parentObj);  //创建时间标签
	lv_obj_set_style_text_font(labelx, &lv_font_montserrat_20,
			LV_STATE_DEFAULT);
	lv_obj_set_style_text_color(labelx, lv_color_black(), LV_STATE_DEFAULT);
	lv_obj_align(labelx, LV_ALIGN_TOP_LEFT, lv_pct(9), lv_pct(25));  //位置
	lv_label_set_text(labelx, "");
    /* 温度曲线按钮 */
    tempCurveBtn = lv_btn_create(parentObj);  //创建工厂保护温度上限报警按钮
    lv_obj_set_size(tempCurveBtn, 132, 58);
    lv_obj_set_style_bg_color(tempCurveBtn, lv_color_hex(0x9c9c9c), LV_STATE_DEFAULT);  //点击颜色
	lv_obj_set_style_bg_img_src(tempCurveBtn, &dsc_ico_buff[10], LV_STATE_DEFAULT);
	lv_obj_set_style_bg_img_src(tempCurveBtn, &dsc_ico_buff[9], LV_STATE_CHECKED);
    lv_obj_align_to(tempCurveBtn, parentObj, LV_ALIGN_TOP_LEFT, lv_pct(81), lv_pct(50));  //位置
    lv_obj_add_event_cb(tempCurveBtn, UI_curve_btn_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 温度曲线按钮标签 */
    label = lv_label_create(tempCurveBtn);
    lv_label_set_text(label, dispText[DA.typeLanguage].temp);
    lv_obj_set_style_text_color(label, lv_color_hex(0x000000), LV_STATE_DEFAULT);
    lv_obj_align_to(label, tempCurveBtn, LV_ALIGN_CENTER, 0, 0);
    /* 流量曲线按钮 */
    flowCurveBtn = lv_btn_create(parentObj);  //创建工厂保护温度上限报警按钮
    lv_obj_set_size(flowCurveBtn, 132, 58);
    lv_obj_set_style_bg_color(flowCurveBtn, lv_color_hex(0x9c9c9c), LV_STATE_DEFAULT);  //点击颜色
	lv_obj_set_style_bg_img_src(flowCurveBtn, &dsc_ico_buff[10], LV_STATE_DEFAULT);
	lv_obj_set_style_bg_img_src(flowCurveBtn, &dsc_ico_buff[9], LV_STATE_CHECKED);
	lv_obj_add_state(flowCurveBtn, LV_STATE_CHECKED);
    lv_obj_align_to(flowCurveBtn, parentObj, LV_ALIGN_TOP_LEFT, lv_pct(81), lv_pct(65));  //位置
    lv_obj_add_event_cb(flowCurveBtn, UI_curve_btn_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 流量曲线按钮标签 */
    label = lv_label_create(flowCurveBtn);
    lv_label_set_text(label, dispText[DA.typeLanguage].Flow);
    lv_obj_set_style_text_color(label, lv_color_hex(0x000000), LV_STATE_DEFAULT);
    lv_obj_align_to(label, flowCurveBtn, LV_ALIGN_CENTER, 0, 0);
	/* 压力曲线按钮 */
    pressCurveBtn = lv_btn_create(parentObj);  //创建工厂保护温度上限报警按钮
    lv_obj_set_size(pressCurveBtn, 132, 58);
    lv_obj_set_style_bg_color(pressCurveBtn, lv_color_hex(0x9c9c9c), LV_STATE_DEFAULT);  //点击颜色
	lv_obj_set_style_bg_img_src(pressCurveBtn, &dsc_ico_buff[10], LV_STATE_DEFAULT);
	lv_obj_set_style_bg_img_src(pressCurveBtn, &dsc_ico_buff[9], LV_STATE_CHECKED);
	lv_obj_align_to(pressCurveBtn, parentObj, LV_ALIGN_TOP_LEFT, lv_pct(81), lv_pct(80));  //位置
	lv_obj_add_event_cb(pressCurveBtn, UI_curve_btn_event_cb, LV_EVENT_CLICKED, NULL);  //事件
	/* 压力曲线按钮标签 */
	label = lv_label_create(pressCurveBtn);
	lv_label_set_text(label, dispText[DA.typeLanguage].press);
	lv_obj_set_style_text_color(label, lv_color_hex(0x000000), LV_STATE_DEFAULT);
	lv_obj_align_to(label, pressCurveBtn, LV_ALIGN_CENTER, 0, 0);
    /* 数据导出按钮 */
    dataExportBtn = lv_btn_create(parentObj);  //数据导出按钮
    lv_obj_align(dataExportBtn, LV_ALIGN_TOP_LEFT, lv_pct(8), lv_pct(85));  //位置
    lv_obj_set_style_bg_color(dataExportBtn, lv_color_hex(0x3a96f1), LV_STATE_DEFAULT);
    lv_obj_add_event_cb(dataExportBtn, UI_curve_btn_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 数据导出标签 */
    label = lv_label_create(dataExportBtn);  //数据导出标签
    lv_obj_align_to(label, dataExportBtn, LV_ALIGN_CENTER, 0, 0);  //位置
    lv_label_set_text(label, LV_SYMBOL_USB);  //文本内容
	if (flowZoom == LV_IMG_ZOOM_NONE) {
		lv_obj_add_state(reduceBtn, LV_STATE_DISABLED);
		lv_obj_add_state(newPosBtn, LV_STATE_DISABLED);
		lv_obj_add_state(oldPosBtn, LV_STATE_DISABLED);
	} else if (flowZoom == DEFAULT_CURVE_MAX_MULTIPLE) {
		lv_obj_add_state(enlargeBtn, LV_STATE_DISABLED);
	}
    /* 曲线定时器 */
    timer = lv_timer_create(UI_flow_timer_event_cb, 100, NULL);  //100mS触发一次
}

/**
  * @brief  压力曲线界面创建
  * @param  无
  * @retval 无
  */
void UI_create_curve_press(void)
{
	/* 初始化上下限 */
	pressChartyMin = (lv_coord_t)FP.LL_PressPV;
	pressChartyMax = (lv_coord_t)FP.HL_PressPV;
	/* 读历史数据 */
	if (g_RW_State == RW_READY)
	{
		g_RW_State = RW_READ_NAND_CURVE;  //读取线
		flag = 1;
	}
    /* 主界面父对象 */
    parentObj = lv_obj_create(lv_scr_act());  //创建父对象
    lv_obj_add_style(parentObj, &style_parentObj, LV_STATE_DEFAULT);  //添加父对象为无填充样式
    lv_obj_set_size(parentObj, lv_pct(100), lv_pct(87));  //设置父对象的大小
    lv_obj_align(parentObj, LV_ALIGN_TOP_MID, lv_pct(0), lv_pct(13));  //设置父对象的位置
	/* 上下限输入框结构体初始化 */
	textarea_init(&pressChartyMin, &pressChartyMax);
    /*创建上下限输入框 */
	for(uint8_t i = 0; i < 2; i++)
	{
		textarea_create_by(parentObj, &taUser_textarea[i]);
	}

    /* 压力图表部件 */
	pressChart = lv_chart_create(parentObj);  //创建温度图表部件
	lv_obj_set_size(pressChart, lv_pct(70), lv_pct(75)); // 设置图表的大小
    lv_obj_align(pressChart, LV_ALIGN_TOP_LEFT, lv_pct(8), lv_pct(10));  //位置
    lv_chart_set_type(pressChart, LV_CHART_TYPE_LINE); // 设置图表类型为折线图
    lv_chart_set_update_mode(pressChart, LV_CHART_UPDATE_MODE_SHIFT);  //循环模式
    lv_obj_set_style_bg_opa(pressChart, 0, LV_PART_INDICATOR);  //设置点的透明度
    lv_obj_set_style_line_width(pressChart, 3, LV_PART_ITEMS);  //设置曲线的粗细
    lv_chart_set_div_line_count(pressChart, 5, pressMultiple * 5);  //重新分配分割线数量
    lv_chart_set_zoom_x(pressChart, pressZoom);
    lv_obj_set_style_text_font(pressChart, &lv_font_montserrat_20, LV_STATE_DEFAULT);
    lv_chart_set_range(pressChart, LV_CHART_AXIS_PRIMARY_Y, \
    		pressChartyMin, pressChartyMax); // 设置Y轴的范围

    pressCursor = lv_chart_add_cursor(pressChart, lv_palette_main(LV_PALETTE_GREY), LV_DIR_VER);
    lv_obj_set_style_line_width(pressChart, 3, LV_PART_CURSOR);
    lv_obj_scroll_to_x(pressChart, pressDistance, LV_ANIM_OFF);  // 回到最新位置
    lv_chart_set_axis_tick(pressChart, LV_CHART_AXIS_PRIMARY_Y, 3, 5, 5, 1, true, 85);

    /* 添加数据 */
    yser1 = lv_chart_add_series(pressChart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y); // 添加一个红色数据系列
    yser2 = lv_chart_add_series(pressChart, lv_palette_main(LV_PALETTE_BLUE), LV_CHART_AXIS_PRIMARY_Y); // 添加一个蓝色数据系列
    yser3 = lv_chart_add_series(pressChart, lv_palette_main(LV_PALETTE_GREEN), LV_CHART_AXIS_PRIMARY_Y); // 添加一个绿色数据系列
    lv_chart_set_point_count(pressChart, CURVEDATASUM); // 设置图表点的数量
    lv_obj_add_event_cb(pressChart, UI_press_curve_event_cb, LV_EVENT_ALL, NULL);  //添加事件
    lv_chart_set_cursor_point(pressChart, pressCursor, yser2, pressArrayPos); //设置光标到触摸点对应的数据点
    lv_obj_clear_flag(pressChart, LV_OBJ_FLAG_SCROLL_MOMENTUM);  //禁止滑动惯性
    /* 回到最新位置按钮 */
    newPosBtn = lv_btn_create(parentObj);  //数据导出按钮
    lv_obj_set_style_bg_color(newPosBtn, lv_color_hex(0x3a96f1), LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(newPosBtn, lv_color_hex(0xcfcfcf), LV_STATE_DISABLED);
    lv_obj_align(newPosBtn, LV_ALIGN_TOP_LEFT, lv_pct(70), lv_pct(85));  //位置
    lv_obj_add_event_cb(newPosBtn, UI_press_curve_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 标签 */
    lv_obj_t * label = lv_label_create(newPosBtn);  //数据导出标签
    lv_obj_align_to(label, newPosBtn, LV_ALIGN_CENTER, 0, 0);  //位置
    lv_label_set_text(label, LV_SYMBOL_RIGHT);  //文本内容

    /* 回到开始位置按钮 */
    oldPosBtn = lv_btn_create(parentObj);  //数据导出按钮
    lv_obj_set_style_bg_color(oldPosBtn, lv_color_hex(0x3a96f1), LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(oldPosBtn, lv_color_hex(0xcfcfcf), LV_STATE_DISABLED);
    lv_obj_align(oldPosBtn, LV_ALIGN_TOP_LEFT, lv_pct(60), lv_pct(85));  //位置
    lv_obj_add_event_cb(oldPosBtn, UI_press_curve_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 开始标签 */
    label = lv_label_create(oldPosBtn);  //数据导出标签
    lv_obj_align_to(label, oldPosBtn, LV_ALIGN_CENTER, 0, 0);  //位置
    lv_label_set_text(label, LV_SYMBOL_LEFT);  //文本内容
    /* 放大按钮 */
    enlargeBtn = lv_btn_create(parentObj);  //数据导出按钮
    lv_obj_align(enlargeBtn, LV_ALIGN_TOP_LEFT, lv_pct(40), lv_pct(85));  //位置
    lv_obj_set_style_bg_color(enlargeBtn, lv_color_hex(0x3a96f1), LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(enlargeBtn, lv_color_hex(0xcfcfcf), LV_STATE_DISABLED);
    lv_obj_add_event_cb(enlargeBtn, UI_press_curve_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 标签 */
    label = lv_label_create(enlargeBtn);  //数据导出标签
    lv_obj_align_to(label, enlargeBtn, LV_ALIGN_CENTER, 0, 0);  //位置
    lv_label_set_text(label, LV_SYMBOL_PLUS);  //文本内容

    /* 缩小按钮 */
    reduceBtn = lv_btn_create(parentObj);  //数据导出按钮
    lv_obj_align(reduceBtn, LV_ALIGN_TOP_LEFT, lv_pct(50), lv_pct(85));  //位置
    lv_obj_set_style_bg_color(reduceBtn, lv_color_hex(0x3a96f1), LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(reduceBtn, lv_color_hex(0xcfcfcf), LV_STATE_DISABLED);
    lv_obj_add_event_cb(reduceBtn, UI_press_curve_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 标签 */
    label = lv_label_create(reduceBtn);  //数据导出标签
    lv_obj_align_to(label, reduceBtn, LV_ALIGN_CENTER, 0, 0);  //位置
    lv_label_set_text(label, LV_SYMBOL_MINUS);  //文本内

    /* 创建标签 */
    label = lv_label_create(parentObj);  //数据导出标签
    lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);  //颜色
    lv_label_set_text(label, "上限:");  //文本内容
    lv_obj_align(label, LV_ALIGN_TOP_LEFT, lv_pct(79), lv_pct(10));  //位置

    label = lv_label_create(parentObj);  //数据导出标签
    lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);  //颜色
    lv_label_set_text(label, "下限:");  //文本内容
    lv_obj_align(label, LV_ALIGN_TOP_LEFT, lv_pct(79), lv_pct(31));  //位置
    /* 红色线条 */
    lv_obj_t *line = lv_line_create(parentObj);  //红色线条
    lv_obj_set_style_line_width(line, 5, LV_STATE_DEFAULT);  //宽度
    lv_obj_set_style_line_rounded(line,true,LV_STATE_DEFAULT);  //端点
    lv_obj_set_style_line_color(line, lv_palette_main(LV_PALETTE_RED), 0);  //颜色
    lv_obj_align(line, LV_ALIGN_TOP_LEFT, lv_pct(10), lv_pct(13));  //位置
    lv_line_set_points(line, line_points, 2);  //坐标点

    /* 红色标签 */
    labely1 = lv_label_create(parentObj);  //数据导出标签
	lv_label_set_text(labely1, "");
	lv_obj_set_style_text_font(labely1, &lv_font_montserrat_20, LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(labely1, lv_palette_main(LV_PALETTE_RED), LV_STATE_DEFAULT);
    lv_obj_align(labely1,  LV_ALIGN_TOP_LEFT, lv_pct(16), lv_pct(11));  //位置

    /* 蓝色线条 */
    line = lv_line_create(parentObj);  //红色线条
    lv_obj_set_style_line_width(line, 5, LV_STATE_DEFAULT);  //宽度
    lv_obj_set_style_line_rounded(line,true,LV_STATE_DEFAULT);  //端点
    lv_obj_set_style_line_color(line, lv_palette_main(LV_PALETTE_BLUE), 0);  //颜色
    lv_obj_align(line, LV_ALIGN_TOP_LEFT, lv_pct(10), lv_pct(19));  //位置
    lv_line_set_points(line, line_points, 2);  //坐标点

    /* 蓝色标签 */
    labely2 = lv_label_create(parentObj);
	lv_label_set_text(labely2, "");
	lv_obj_set_style_text_font(labely2, &lv_font_montserrat_20, LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(labely2, lv_palette_main(LV_PALETTE_BLUE), LV_STATE_DEFAULT);
    lv_obj_align(labely2,  LV_ALIGN_TOP_LEFT, lv_pct(16), lv_pct(17));  //位置

    /* 绿色线条 */
    line = lv_line_create(parentObj);  //红色线条
    lv_obj_set_style_line_width(line, 5, LV_STATE_DEFAULT);  //宽度
    lv_obj_set_style_line_rounded(line,true,LV_STATE_DEFAULT);  //端点
    lv_obj_set_style_line_color(line, lv_palette_main(LV_PALETTE_GREEN), 0);  //颜色
    lv_obj_align(line, LV_ALIGN_TOP_LEFT, lv_pct(10), lv_pct(25));  //位置
    lv_line_set_points(line, line_points, 2);  //坐标点

    /* 绿色标签 */
    labely3 = lv_label_create(parentObj);
 	lv_label_set_text(labely3, "");
 	lv_obj_set_style_text_font(labely3, &lv_font_montserrat_20, LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(labely3, lv_palette_main(LV_PALETTE_GREEN), LV_STATE_DEFAULT);
    lv_obj_align(labely3,  LV_ALIGN_TOP_LEFT, lv_pct(16), lv_pct(23));  //位置

    /* 时间显示标签 */
    labelx = lv_label_create(parentObj);  //创建时间标签
    lv_obj_set_style_text_font(labelx, &lv_font_montserrat_20, LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(labelx, lv_color_black(), LV_STATE_DEFAULT);
    lv_obj_align(labelx, LV_ALIGN_TOP_LEFT, lv_pct(9), lv_pct(29));  //位置
    lv_label_set_text(labelx, "");
    /* 温度曲线按钮 */
    tempCurveBtn = lv_btn_create(parentObj);  //创建工厂保护温度上限报警按钮
    lv_obj_set_size(tempCurveBtn, 132, 58);
    lv_obj_set_style_bg_color(tempCurveBtn, lv_color_hex(0x9c9c9c), LV_STATE_DEFAULT);  //点击颜色
	lv_obj_set_style_bg_img_src(tempCurveBtn, &dsc_ico_buff[10], LV_STATE_DEFAULT);
	lv_obj_set_style_bg_img_src(tempCurveBtn, &dsc_ico_buff[9], LV_STATE_CHECKED);
    lv_obj_align_to(tempCurveBtn, parentObj, LV_ALIGN_TOP_LEFT, lv_pct(81), lv_pct(65));  //位置

    lv_obj_add_event_cb(tempCurveBtn, UI_curve_btn_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 温度曲线按钮标签 */
    label = lv_label_create(tempCurveBtn);
    lv_label_set_text(label, dispText[DA.typeLanguage].temp);
    lv_obj_set_style_text_color(label, lv_color_hex(0x000000), LV_STATE_DEFAULT);
    lv_obj_align_to(label, tempCurveBtn, LV_ALIGN_CENTER, 0, 0);
//    /* 流量曲线按钮 */
//    flowCurveBtn = lv_btn_create(parentObj);  //创建工厂保护温度上限报警按钮
//    lv_obj_set_size(flowCurveBtn, 132, 58);
//    lv_obj_set_style_bg_color(flowCurveBtn, lv_color_hex(0x9c9c9c), LV_STATE_DEFAULT);  //点击颜色
//	lv_obj_set_style_bg_img_src(flowCurveBtn, &dsc_ico_buff[10], LV_STATE_DEFAULT);
//	lv_obj_set_style_bg_img_src(flowCurveBtn, &dsc_ico_buff[9], LV_STATE_CHECKED);
//    lv_obj_align_to(flowCurveBtn, parentObj, LV_ALIGN_TOP_LEFT, lv_pct(81), lv_pct(65));  //位置
//    lv_obj_add_event_cb(flowCurveBtn, UI_curve_btn_event_cb, LV_EVENT_CLICKED, NULL);  //事件
//    /* 流量曲线按钮标签 */
//    label = lv_label_create(flowCurveBtn);
//    lv_label_set_text(label, dispText[DA.typeLanguage].Flow);
//    lv_obj_set_style_text_color(label, lv_color_hex(0x000000), LV_STATE_DEFAULT);
//    lv_obj_align_to(label, flowCurveBtn, LV_ALIGN_CENTER, 0, 0);
	/* 压力曲线按钮 */
    pressCurveBtn = lv_btn_create(parentObj);  //创建工厂保护温度上限报警按钮
    lv_obj_set_size(pressCurveBtn, 132, 58);
    lv_obj_set_style_bg_color(pressCurveBtn, lv_color_hex(0x9c9c9c), LV_STATE_DEFAULT);  //点击颜色
	lv_obj_set_style_bg_img_src(pressCurveBtn, &dsc_ico_buff[10], LV_STATE_DEFAULT);
	lv_obj_set_style_bg_img_src(pressCurveBtn, &dsc_ico_buff[9], LV_STATE_CHECKED);
    lv_obj_add_state(pressCurveBtn, LV_STATE_CHECKED);
	lv_obj_align_to(pressCurveBtn, parentObj, LV_ALIGN_TOP_LEFT, lv_pct(81), lv_pct(80));  //位置
	lv_obj_add_event_cb(pressCurveBtn, UI_curve_btn_event_cb, LV_EVENT_CLICKED, NULL);  //事件
	/* 压力曲线按钮标签 */
	label = lv_label_create(pressCurveBtn);
	lv_label_set_text(label, dispText[DA.typeLanguage].press);
	lv_obj_set_style_text_color(label, lv_color_hex(0x000000), LV_STATE_DEFAULT);
	lv_obj_align_to(label, pressCurveBtn, LV_ALIGN_CENTER, 0, 0);
    /* 数据导出按钮 */
    dataExportBtn = lv_btn_create(parentObj);  //数据导出按钮
    lv_obj_align(dataExportBtn, LV_ALIGN_TOP_LEFT, lv_pct(8), lv_pct(85));  //位置
    lv_obj_set_style_bg_color(dataExportBtn, lv_color_hex(0x3a96f1), LV_STATE_DEFAULT);
    lv_obj_add_event_cb(dataExportBtn, UI_curve_btn_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 数据导出标签 */
    label = lv_label_create(dataExportBtn);  //数据导出标签
    lv_obj_align_to(label, dataExportBtn, LV_ALIGN_CENTER, 0, 0);  //位置
    lv_label_set_text(label, LV_SYMBOL_USB);  //文本内容

    if (pressZoom == LV_IMG_ZOOM_NONE)
    {
    	lv_obj_add_state(reduceBtn, LV_STATE_DISABLED);
    	lv_obj_add_state(newPosBtn, LV_STATE_DISABLED);
    	lv_obj_add_state(oldPosBtn, LV_STATE_DISABLED);
    }
    else if (pressZoom == DEFAULT_CURVE_MAX_MULTIPLE)
    {
    	lv_obj_add_state(enlargeBtn, LV_STATE_DISABLED);
    }

    /* 曲线定时器 */
    timer = lv_timer_create(UI_press_timer_event_cb, 100, NULL);  //100mS触发一次
}

/**
  * @brief  曲线界面创建
  * @param  无
  * @retval 无
  */
void UI_create_curve(void)
{
	/* 创建背景图片 */
	parentObj_img = lv_img_create(lv_scr_act());
    lv_img_set_src(parentObj_img, &dsc_img_buff[2]);
    lv_obj_add_style(parentObj_img, &style_parentObj, LV_STATE_DEFAULT);  //添加父对象为无填充样式
    lv_obj_set_size(parentObj_img, lv_pct(100), lv_pct(100));  //设置父对象的大小
    lv_obj_align(parentObj_img, LV_ALIGN_BOTTOM_MID, 0, 0);  //设置父对象的位置
    /* 创建温度曲线 */
    UI_create_curve_temp();
}
/**
  * @brief  曲线界面删除
  * @param  无
  * @retval 无
  */
void UI_delete_curve(void)
{
	lv_obj_del(parentObj);  //删除当前界面
	lv_obj_del(parentObj_img);  //删除当前界面
	lv_timer_del(timer);  //删除当前界面定时器
	flag = 0;
	bufPoint = 0;
}

/**
* @brief 数据导出按钮回调
* @param *e ：事件相关参数的集合，它包含了该事件的所有数据
* @return 无
*/
static void UI_curve_export_btn_event_cb(lv_event_t* e)
{
    lv_obj_t* target = lv_event_get_target(e); /* 获取触发源 */

    if (target == dataExpConfBtn)  //数据导出确认按钮
    {
    	g_packReadOK = 1;
        lv_label_set_text(dataExpLabel, dispText[DA.typeLanguage].exporting);  //导出中
		lv_obj_add_flag(dataExpConfBtn, LV_OBJ_FLAG_HIDDEN);  //隐藏
		lv_obj_add_flag(dataExpCancelBtn, LV_OBJ_FLAG_HIDDEN);  //隐藏
		lv_obj_clear_flag(dataExpConfFinishBtn, LV_OBJ_FLAG_HIDDEN);  //显示
        g_RW_State = RW_EXPORT_USB_DATA;  //导出数据
    }
    else if (target == dataExpCancelBtn)  //数据导出取消按钮
    {
        UI_delete_curve_export_display();
    }
    else if (target == dataExpConfFinishBtn)  //数据导出完成确认按钮
    {
    	g_packReadOK = 0;
        UI_delete_curve_export_display();
    }
}

/**
* @brief 导出脚本定时器回调  200ms
* @param *e ：事件相关参数的集合，它包含了该事件的所有数据
* @return 无
*/
void UI_exp_timer_event_cb(lv_timer_t* timer)
{

	if(g_packReadOK == 2)  //导出成功
	{
		lv_label_set_text(dataExpLabel, dispText[DA.typeLanguage].exportSuccessful);  //导出成功

	}
	else if(g_packReadOK == 3)  //导出失败
	{
		lv_label_set_text(dataExpLabel, dispText[DA.typeLanguage].exportFailed);  //导出失败
	}
}

/**
  * @brief  曲线数据导出界面创建
  * @param  无
  * @retval 无
  */
void UI_create_curve_export_display(void)
{
	lv_obj_t* label = NULL;  //显示标签

    /* 切换显示参数窗口父对象 */
    parentObj1 = lv_obj_create(parentObj);  //创建父对象
    lv_obj_add_style(parentObj1, &style_parentObj1, LV_STATE_DEFAULT);  //添加父对象为无填充样式
    lv_obj_set_size(parentObj1, lv_pct(88), lv_pct(83));  //设置父对象的大小
    lv_obj_set_style_align(parentObj1, LV_ALIGN_CENTER, LV_STATE_DEFAULT);  //设置父对象的位置
    /* 数据导出窗口标签 */
    dataExpLabel = lv_label_create(parentObj1);  //创建运行窗口标签
    lv_obj_align(dataExpLabel, LV_ALIGN_TOP_MID, 0, lv_pct(20));
    lv_label_set_text(dataExpLabel, dispText[DA.typeLanguage].dataExport);
    /* 数据导出确认按钮 */
    dataExpConfBtn = lv_btn_create(parentObj1);  //创建运行窗口运行按钮
    lv_obj_align_to(dataExpConfBtn, parentObj1, LV_ALIGN_TOP_LEFT, lv_pct(20), lv_pct(70));  //位置
    lv_obj_add_event_cb(dataExpConfBtn, UI_curve_export_btn_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 数据导出确认标签 */
    label = lv_label_create(dataExpConfBtn);  //创建运行窗口标签
    lv_obj_align_to(label, dataExpConfBtn, LV_ALIGN_TOP_LEFT, 0, 0);  //位置
    lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
    lv_label_set_text(label, dispText[DA.typeLanguage].confirm);
    lv_label_set_recolor(label, true);  //启用标签文本重新着色
    /* 数据导出取消按钮 */
    dataExpCancelBtn = lv_btn_create(parentObj1);  //创建运行窗口取消按钮
    lv_obj_align_to(dataExpCancelBtn, parentObj1, LV_ALIGN_TOP_LEFT, lv_pct(60), lv_pct(70));  //位置
    lv_obj_set_style_bg_color(dataExpCancelBtn, lv_color_hex(0x202020), LV_STATE_DEFAULT); //设置对象背景颜色
    lv_obj_add_event_cb(dataExpCancelBtn, UI_curve_export_btn_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    /* 数据导出取消标签 */
    label = lv_label_create(dataExpCancelBtn);  //创建运行窗口标签
    lv_obj_align_to(label, dataExpCancelBtn, LV_ALIGN_TOP_LEFT, 0, 0);  //位置
    lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
    lv_label_set_text(label, dispText[DA.typeLanguage].cancel);
    lv_label_set_recolor(label, true);  //启用标签文本重新着色

    /* 数据导出完成确认按钮 */
    dataExpConfFinishBtn = lv_btn_create(parentObj1);  //创建运行窗口运行按钮
    lv_obj_align_to(dataExpConfFinishBtn, parentObj1, LV_ALIGN_TOP_LEFT, lv_pct(40), lv_pct(70));  //位置
    lv_obj_add_event_cb(dataExpConfFinishBtn, UI_curve_export_btn_event_cb, LV_EVENT_CLICKED, NULL);  //事件
    lv_obj_add_flag(dataExpConfFinishBtn, LV_OBJ_FLAG_HIDDEN);  //隐藏
    /* 数据导出确认标签 */
    label = lv_label_create(dataExpConfFinishBtn);  //创建运行窗口标签
    lv_obj_align_to(label, dataExpConfFinishBtn, LV_ALIGN_TOP_LEFT, 0, 0);  //位置
    lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
    lv_label_set_text(label, dispText[DA.typeLanguage].confirm);
    lv_label_set_recolor(label, true);  //启用标签文本重新着色
//    /* 数据导出图标 */
//    lv_obj_t* img = lv_img_create(parentObj);
//    lv_img_set_src(img, &ico_buff[20]);
//    lv_obj_align(img, LV_ALIGN_TOP_LEFT, lv_pct(85), lv_pct(15));  //设置低液位图标的位置
    /* 导出脚本定时器 */
    expTimer = lv_timer_create(UI_exp_timer_event_cb, 200, NULL);  //200mS触发一次
}

/**
  * @brief  曲线数据导出界面删除
  * @param  无
  * @retval 无
  */
void UI_delete_curve_export_display(void)
{
    lv_obj_del(parentObj1);  //删除当前界面
    lv_timer_del(expTimer);  //删除定时器
}
